package com.beiming.kotlindemo.activity

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

/**
 * Created by lingchen on 2020/4/30. 16:41
 * mail:lingchen52@foxmail.com
 */
abstract class BaseActivity : AppCompatActivity() {
    val TAG = javaClass.simpleName

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(getContentResId())
        resumeSavedInstanceState(savedInstanceState)
        initView()
        initData()
    }

    abstract fun getContentResId(): Int

    /**
     * 恢复Activity销毁时保存的数据
     */
    open fun resumeSavedInstanceState(savedInstanceState: Bundle?) {}

    abstract fun initView()

    abstract fun initData()

}